import java.math.BigInteger;

import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.MD5Hash;

import com.google.common.base.Stopwatch;

public class Demo {

	public static void main(String[] args) {
		long i;        //定义一个Long型变量
//		com.google.common.base.Stopwatch dStopwatch = new Stopwatch();
		 
		i = Long.reverse(10);
		System.out.println(i);
	     System.out.println("Binary = " + Long.toBinaryString(10));
	     byte[] bs =  Long.toBinaryString(10).getBytes();
	     for (byte b : bs) {
			System.out.println(b);
		}
	     System.out.println("Binary = " + Long.toBinaryString(i));
	     long currentId = 1L;  
	     byte [] rowkey = Bytes.add(MD5Hash.getMD5AsHex(Bytes.toBytes(currentId))  
	                         .substring(0, 8).getBytes(),Bytes.toBytes(currentId));  
	     System.out.println(rowkey.length);
	     System.out.println(binary(rowkey,2));
	}
    public static String binary(byte[] bytes, int radix){  
        return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数  
    }  
}
